package com.jar.exercise.泛型.泛型方法;

import java.util.Collection;

public class Main {
    // get
    public <E> E get(int id, E e) {
        return e;
    }

    // add
    public static <T> void add(T object, Collection<T> list) {
        list.add(object);
    }
}

class PersonTest{
    public static <T extends Person> void get(T object) {
        if (object instanceof Student) {
            System.out.println("学生");
        }
        if (object instanceof Teacher) {
            System.out.println("老师");
        }
    }

    public static void main(String[] args) {
        get(new Student());
        get(new Teacher());

    }
}
class Person{}
class Student extends Person{}
class Teacher extends Person{}

